home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / necko / nsITransport.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-05-08  |  13.1 KB  |  330 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsITransport.idl
  3.  */
  4.  
  5. #ifndef __gen_nsITransport_h__
  6. #define __gen_nsITransport_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsIInputStream; /* forward declaration */
  18.  
  19. class nsIOutputStream; /* forward declaration */
  20.  
  21. class nsITransportEventSink; /* forward declaration */
  22.  
  23. class nsIEventTarget; /* forward declaration */
  24.  
  25.  
  26. /* starting interface:    nsITransport */
  27. #define NS_ITRANSPORT_IID_STR "cbb0baeb-5fcb-408b-a2be-9f8fc98d0af1"
  28.  
  29. #define NS_ITRANSPORT_IID \
  30.   {0xcbb0baeb, 0x5fcb, 0x408b, \
  31.     { 0xa2, 0xbe, 0x9f, 0x8f, 0xc9, 0x8d, 0x0a, 0xf1 }}
  32.  
  33. /**
  34.  * nsITransport
  35.  *
  36.  * This interface provides a common way of accessing i/o streams connected
  37.  * to some resource.  This interface does not in any way specify the resource.
  38.  * It provides methods to open blocking or non-blocking, buffered or unbuffered
  39.  * streams to the resource.  The name "transport" is meant to connote the 
  40.  * inherent data transfer implied by this interface (i.e., data is being
  41.  * transfered in some fashion via the streams exposed by this interface).
  42.  *
  43.  * A transport can have an event sink associated with it.  The event sink 
  44.  * receives transport-specific events as the transfer is occuring.  For a
  45.  * socket transport, these events can include status about the connection.
  46.  * See nsISocketTransport for more info about socket transport specifics.
  47.  */
  48. class NS_NO_VTABLE nsITransport : public nsISupports {
  49.  public: 
  50.  
  51.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITRANSPORT_IID)
  52.  
  53.   /**
  54.      * Open flags.
  55.      */
  56.   enum { OPEN_BLOCKING = 1U };
  57.  
  58.   enum { OPEN_UNBUFFERED = 2U };
  59.  
  60.   /**
  61.      * Open an input stream on this transport.
  62.      *
  63.      * Flags have the following meaning:
  64.      *
  65.      * OPEN_BLOCKING
  66.      *   If specified, then the resulting stream will have blocking stream
  67.      *   semantics.  This means that if the stream has no data and is not
  68.      *   closed, then reading from it will block the calling thread until
  69.      *   at least one byte is available or until the stream is closed.
  70.      *   If this flag is NOT specified, then the stream has non-blocking
  71.      *   stream semantics.  This means that if the stream has no data and is
  72.      *   not closed, then reading from it returns NS_BASE_STREAM_WOULD_BLOCK.
  73.      *   In addition, in non-blocking mode, the stream is guaranteed to 
  74.      *   support nsIAsyncInputStream.  This interface allows the consumer of
  75.      *   the stream to be notified when the stream can again be read.
  76.      *
  77.      * OPEN_UNBUFFERED
  78.      *   If specified, the resulting stream may not support ReadSegments.
  79.      *   ReadSegments is only gauranteed to be implemented when this flag is
  80.      *   NOT specified.
  81.      *
  82.      * @param aFlags
  83.      *        optional transport specific flags.
  84.      * @param aSegmentSize
  85.      *        if OPEN_UNBUFFERED is not set, then this parameter specifies the
  86.      *        size of each buffer segment (pass 0 to use default value).
  87.      * @param aSegmentCount
  88.      *        if OPEN_UNBUFFERED is not set, then this parameter specifies the
  89.      *        maximum number of buffer segments (pass 0 to use default value).
  90.      */
  91.   /* nsIInputStream openInputStream (in unsigned long aFlags, in unsigned long aSegmentSize, in unsigned long aSegmentCount); */
  92.   NS_IMETHOD OpenInputStream(PRUint32 aFlags, PRUint32 aSegmentSize, PRUint32 aSegmentCount, nsIInputStream **_retval) = 0;
  93.  
  94.   /**
  95.      * Open an output stream on this transport.
  96.      *
  97.      * Flags have the following meaning:
  98.      *
  99.      * OPEN_BLOCKING
  100.      *   If specified, then the resulting stream will have blocking stream
  101.      *   semantics.  This means that if the stream is full and is not closed,
  102.      *   then writing to it will block the calling thread until ALL of the
  103.      *   data can be written or until the stream is closed.  If this flag is
  104.      *   NOT specified, then the stream has non-blocking stream semantics.
  105.      *   This means that if the stream is full and is not closed, then writing
  106.      *   to it returns NS_BASE_STREAM_WOULD_BLOCK.  In addition, in non-
  107.      *   blocking mode, the stream is guaranteed to support
  108.      *   nsIAsyncOutputStream.  This interface allows the consumer of the
  109.      *   stream to be notified when the stream can again accept more data.
  110.      *
  111.      * OPEN_UNBUFFERED
  112.      *   If specified, the resulting stream may not support WriteSegments and
  113.      *   WriteFrom.  WriteSegments and WriteFrom are only gauranteed to be
  114.      *   implemented when this flag is NOT specified.
  115.      *
  116.      * @param aFlags
  117.      *        optional transport specific flags.
  118.      * @param aSegmentSize
  119.      *        if OPEN_UNBUFFERED is not set, then this parameter specifies the
  120.      *        size of each buffer segment (pass 0 to use default value).
  121.      * @param aSegmentCount
  122.      *        if OPEN_UNBUFFERED is not set, then this parameter specifies the
  123.      *        maximum number of buffer segments (pass 0 to use default value).
  124.      */
  125.   /* nsIOutputStream openOutputStream (in unsigned long aFlags, in unsigned long aSegmentSize, in unsigned long aSegmentCount); */
  126.   NS_IMETHOD OpenOutputStream(PRUint32 aFlags, PRUint32 aSegmentSize, PRUint32 aSegmentCount, nsIOutputStream **_retval) = 0;
  127.  
  128.   /**
  129.      * Close the transport and any open streams.
  130.      *
  131.      * @param aReason
  132.      *        the reason for closing the stream.
  133.      */
  134.   /* void close (in nsresult aReason); */
  135.   NS_IMETHOD Close(nsresult aReason) = 0;
  136.  
  137.   /**
  138.      * Set the transport event sink.
  139.      *
  140.      * @param aSink
  141.      *        receives transport layer notifications
  142.      * @param aEventTarget
  143.      *        indicates the event target to which the notifications should
  144.      *        be delivered.  if NULL, then the notifications may occur on
  145.      *        any thread.
  146.      */
  147.   /* void setEventSink (in nsITransportEventSink aSink, in nsIEventTarget aEventTarget); */
  148.   NS_IMETHOD SetEventSink(nsITransportEventSink *aSink, nsIEventTarget *aEventTarget) = 0;
  149.  
  150.   /**
  151.      * Generic nsITransportEventSink status codes.  nsITransport
  152.      * implementations may override these status codes with their own more
  153.      * specific status codes (e.g., see nsISocketTransport).
  154.      */
  155.   enum { STATUS_READING = 2152398856U };
  156.  
  157.   enum { STATUS_WRITING = 2152398857U };
  158.  
  159. };
  160.  
  161. /* Use this macro when declaring classes that implement this interface. */
  162. #define NS_DECL_NSITRANSPORT \
  163.   NS_IMETHOD OpenInputStream(PRUint32 aFlags, PRUint32 aSegmentSize, PRUint32 aSegmentCount, nsIInputStream **_retval); \
  164.   NS_IMETHOD OpenOutputStream(PRUint32 aFlags, PRUint32 aSegmentSize, PRUint32 aSegmentCount, nsIOutputStream **_retval); \
  165.   NS_IMETHOD Close(nsresult aReason); \
  166.   NS_IMETHOD SetEventSink(nsITransportEventSink *aSink, nsIEventTarget *aEventTarget); \
  167.  
  168. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  169. #define NS_FORWARD_NSITRANSPORT(_to) \
  170.   NS_IMETHOD OpenInputStream(PRUint32 aFlags, PRUint32 aSegmentSize, PRUint32 aSegmentCount, nsIInputStream **_retval) { return _to OpenInputStream(aFlags, aSegmentSize, aSegmentCount, _retval); } \
  171.   NS_IMETHOD OpenOutputStream(PRUint32 aFlags, PRUint32 aSegmentSize, PRUint32 aSegmentCount, nsIOutputStream **_retval) { return _to OpenOutputStream(aFlags, aSegmentSize, aSegmentCount, _retval); } \
  172.   NS_IMETHOD Close(nsresult aReason) { return _to Close(aReason); } \
  173.   NS_IMETHOD SetEventSink(nsITransportEventSink *aSink, nsIEventTarget *aEventTarget) { return _to SetEventSink(aSink, aEventTarget); } \
  174.  
  175. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  176. #define NS_FORWARD_SAFE_NSITRANSPORT(_to) \
  177.   NS_IMETHOD OpenInputStream(PRUint32 aFlags, PRUint32 aSegmentSize, PRUint32 aSegmentCount, nsIInputStream **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->OpenInputStream(aFlags, aSegmentSize, aSegmentCount, _retval); } \
  178.   NS_IMETHOD OpenOutputStream(PRUint32 aFlags, PRUint32 aSegmentSize, PRUint32 aSegmentCount, nsIOutputStream **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->OpenOutputStream(aFlags, aSegmentSize, aSegmentCount, _retval); } \
  179.   NS_IMETHOD Close(nsresult aReason) { return !_to ? NS_ERROR_NULL_POINTER : _to->Close(aReason); } \
  180.   NS_IMETHOD SetEventSink(nsITransportEventSink *aSink, nsIEventTarget *aEventTarget) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetEventSink(aSink, aEventTarget); } \
  181.  
  182. #if 0
  183. /* Use the code below as a template for the implementation class for this interface. */
  184.  
  185. /* Header file */
  186. class nsTransport : public nsITransport
  187. {
  188. public:
  189.   NS_DECL_ISUPPORTS
  190.   NS_DECL_NSITRANSPORT
  191.  
  192.   nsTransport();
  193.  
  194. private:
  195.   ~nsTransport();
  196.  
  197. protected:
  198.   /* additional members */
  199. };
  200.  
  201. /* Implementation file */
  202. NS_IMPL_ISUPPORTS1(nsTransport, nsITransport)
  203.  
  204. nsTransport::nsTransport()
  205. {
  206.   /* member initializers and constructor code */
  207. }
  208.  
  209. nsTransport::~nsTransport()
  210. {
  211.   /* destructor code */
  212. }
  213.  
  214. /* nsIInputStream openInputStream (in unsigned long aFlags, in unsigned long aSegmentSize, in unsigned long aSegmentCount); */
  215. NS_IMETHODIMP nsTransport::OpenInputStream(PRUint32 aFlags, PRUint32 aSegmentSize, PRUint32 aSegmentCount, nsIInputStream **_retval)
  216. {
  217.     return NS_ERROR_NOT_IMPLEMENTED;
  218. }
  219.  
  220. /* nsIOutputStream openOutputStream (in unsigned long aFlags, in unsigned long aSegmentSize, in unsigned long aSegmentCount); */
  221. NS_IMETHODIMP nsTransport::OpenOutputStream(PRUint32 aFlags, PRUint32 aSegmentSize, PRUint32 aSegmentCount, nsIOutputStream **_retval)
  222. {
  223.     return NS_ERROR_NOT_IMPLEMENTED;
  224. }
  225.  
  226. /* void close (in nsresult aReason); */
  227. NS_IMETHODIMP nsTransport::Close(nsresult aReason)
  228. {
  229.     return NS_ERROR_NOT_IMPLEMENTED;
  230. }
  231.  
  232. /* void setEventSink (in nsITransportEventSink aSink, in nsIEventTarget aEventTarget); */
  233. NS_IMETHODIMP nsTransport::SetEventSink(nsITransportEventSink *aSink, nsIEventTarget *aEventTarget)
  234. {
  235.     return NS_ERROR_NOT_IMPLEMENTED;
  236. }
  237.  
  238. /* End of implementation class template. */
  239. #endif
  240.  
  241.  
  242. /* starting interface:    nsITransportEventSink */
  243. #define NS_ITRANSPORTEVENTSINK_IID_STR "eda4f520-67f7-484b-a691-8c3226a5b0a6"
  244.  
  245. #define NS_ITRANSPORTEVENTSINK_IID \
  246.   {0xeda4f520, 0x67f7, 0x484b, \
  247.     { 0xa6, 0x91, 0x8c, 0x32, 0x26, 0xa5, 0xb0, 0xa6 }}
  248.  
  249. class NS_NO_VTABLE nsITransportEventSink : public nsISupports {
  250.  public: 
  251.  
  252.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITRANSPORTEVENTSINK_IID)
  253.  
  254.   /**
  255.      * Transport status notification.
  256.      *
  257.      * @param aTransport
  258.      *        the transport sending this status notification.
  259.      * @param aStatus
  260.      *        the transport status (resolvable to a string using
  261.      *        nsIErrorService). See nsISocketTransport for socket specific
  262.      *        status codes and more comments.
  263.      * @param aProgress
  264.      *        the amount of data either read or written depending on the value
  265.      *        of the status code.  this value is relative to aProgressMax.
  266.      * @param aProgressMax
  267.      *        the maximum amount of data that will be read or written.  if
  268.      *        unknown, 0xFFFFFFFF will be passed.
  269.      */
  270.   /* void onTransportStatus (in nsITransport aTransport, in nsresult aStatus, in unsigned long long aProgress, in unsigned long long aProgressMax); */
  271.   NS_IMETHOD OnTransportStatus(nsITransport *aTransport, nsresult aStatus, PRUint64 aProgress, PRUint64 aProgressMax) = 0;
  272.  
  273. };
  274.  
  275. /* Use this macro when declaring classes that implement this interface. */
  276. #define NS_DECL_NSITRANSPORTEVENTSINK \
  277.   NS_IMETHOD OnTransportStatus(nsITransport *aTransport, nsresult aStatus, PRUint64 aProgress, PRUint64 aProgressMax); 
  278.  
  279. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  280. #define NS_FORWARD_NSITRANSPORTEVENTSINK(_to) \
  281.   NS_IMETHOD OnTransportStatus(nsITransport *aTransport, nsresult aStatus, PRUint64 aProgress, PRUint64 aProgressMax) { return _to OnTransportStatus(aTransport, aStatus, aProgress, aProgressMax); } 
  282.  
  283. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  284. #define NS_FORWARD_SAFE_NSITRANSPORTEVENTSINK(_to) \
  285.   NS_IMETHOD OnTransportStatus(nsITransport *aTransport, nsresult aStatus, PRUint64 aProgress, PRUint64 aProgressMax) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnTransportStatus(aTransport, aStatus, aProgress, aProgressMax); } 
  286.  
  287. #if 0
  288. /* Use the code below as a template for the implementation class for this interface. */
  289.  
  290. /* Header file */
  291. class nsTransportEventSink : public nsITransportEventSink
  292. {
  293. public:
  294.   NS_DECL_ISUPPORTS
  295.   NS_DECL_NSITRANSPORTEVENTSINK
  296.  
  297.   nsTransportEventSink();
  298.  
  299. private:
  300.   ~nsTransportEventSink();
  301.  
  302. protected:
  303.   /* additional members */
  304. };
  305.  
  306. /* Implementation file */
  307. NS_IMPL_ISUPPORTS1(nsTransportEventSink, nsITransportEventSink)
  308.  
  309. nsTransportEventSink::nsTransportEventSink()
  310. {
  311.   /* member initializers and constructor code */
  312. }
  313.  
  314. nsTransportEventSink::~nsTransportEventSink()
  315. {
  316.   /* destructor code */
  317. }
  318.  
  319. /* void onTransportStatus (in nsITransport aTransport, in nsresult aStatus, in unsigned long long aProgress, in unsigned long long aProgressMax); */
  320. NS_IMETHODIMP nsTransportEventSink::OnTransportStatus(nsITransport *aTransport, nsresult aStatus, PRUint64 aProgress, PRUint64 aProgressMax)
  321. {
  322.     return NS_ERROR_NOT_IMPLEMENTED;
  323. }
  324.  
  325. /* End of implementation class template. */
  326. #endif
  327.  
  328.  
  329. #endif /* __gen_nsITransport_h__ */
  330.